import gtk
from . import toolkit



def action(configpath):
    def deco(func):
        func._gtdom = {
            "configpath" : configpath, 
        }
        return func
    return deco


class FunctionalityContainer(object):
    def _get_actions(self, config):
        actions = []
        for name in dir(self):
            info = getattr(getattr(self, name, None), "_gtdom", None)
            if info is None:
                continue
            path = info["configpath"].split(".")
            c = config
            for p in path:
                c = c[p]
            actions.append(c)
        return actions
    
    def render(self, config):
        raise NotImplementedError()
    
class Module(FunctionalityContainer):
    def render(self, config):
        actions = self._get_actions()
        for act in actions:
            
            act["name"]
        return toolkit.Frame(self.TITLE, 
            VBox(
                menu,
                self._render(config)
            )
        )

    def _render(self, config):
        raise NotImplementedError()
    

class Application(FunctionalityContainer):
    pass






